package cn.b504.qpcr.entity

class AjaxResult(val code: Int, val data: Any?, val message: String?) {

    companion object {
        @JvmStatic
        @JvmOverloads
        fun ok(data: Any?, message: String? = ""): AjaxResult {
            return AjaxResult(200, data, message)
        }

        @JvmStatic
        fun ok(data: Any?, message: String? = "", code: Int): AjaxResult {
            return AjaxResult(code, data, message)
        }

        @JvmStatic
        @JvmOverloads
        fun error(data: Any?, message: String? = ""): AjaxResult {
            return AjaxResult(500, data, message)
        }

        @JvmStatic
        fun error(data: Any?, message: String? = "", code: Int): AjaxResult {
            return AjaxResult(code, data, message)
        }
    }
}